<?php
namespace Common\Controller;
use Common\Controller\CommonController;
class GuessStarController extends CommonController
{

    /**
     * 缓存本周排行
     */
    public function cachestarweek(){

        $year = date('Y');
        $week = (int)date('W');
        $info = M();

        $where = array(
            'year'=>$year,
            'week'=>$week,
        );

        $list   =   $info->table('mj_star_week')->where($where)->field('star_member_id,getnum,star_week_id,nickName,avatarUrl')->order('getnum desc' )->limit(100)->select();

        S('starweek',$list,360);
    }

    /**
     * 获取本周排行
     */

    public function getstarweek(){

        $cache = S('starweek');

        if (!$cache||$cache==''){
            $this->cachestarweek();
            $cache = S('starweek');
        }

        return $cache;

    }

}